/**
 * This is my code.
 *
 * $Id$
 */
package fi.jab.esb.config.xml.impl;

import fi.jab.esb.config.xml.DestTypeType;
import fi.jab.esb.config.xml.JmsMessageFilterType;
import fi.jab.esb.config.xml.XmlPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Jms Message Filter Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link fi.jab.esb.config.xml.impl.JmsMessageFilterTypeImpl#getAcknowledgeMode <em>Acknowledge Mode</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.JmsMessageFilterTypeImpl#getDestName <em>Dest Name</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.JmsMessageFilterTypeImpl#getDestType <em>Dest Type</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.JmsMessageFilterTypeImpl#isPersistent <em>Persistent</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.JmsMessageFilterTypeImpl#getSelector <em>Selector</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class JmsMessageFilterTypeImpl extends EObjectImpl implements JmsMessageFilterType
{
  /**
   * The default value of the '{@link #getAcknowledgeMode() <em>Acknowledge Mode</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAcknowledgeMode()
   * @generated
   * @ordered
   */
  protected static final String ACKNOWLEDGE_MODE_EDEFAULT = "AUTO_ACKNOWLEDGE";

  /**
   * The cached value of the '{@link #getAcknowledgeMode() <em>Acknowledge Mode</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAcknowledgeMode()
   * @generated
   * @ordered
   */
  protected String acknowledgeMode = ACKNOWLEDGE_MODE_EDEFAULT;

  /**
   * This is true if the Acknowledge Mode attribute has been set.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   * @ordered
   */
  protected boolean acknowledgeModeESet;

  /**
   * The default value of the '{@link #getDestName() <em>Dest Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDestName()
   * @generated
   * @ordered
   */
  protected static final String DEST_NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getDestName() <em>Dest Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDestName()
   * @generated
   * @ordered
   */
  protected String destName = DEST_NAME_EDEFAULT;

  /**
   * The default value of the '{@link #getDestType() <em>Dest Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDestType()
   * @generated
   * @ordered
   */
  protected static final DestTypeType DEST_TYPE_EDEFAULT = DestTypeType.QUEUE;

  /**
   * The cached value of the '{@link #getDestType() <em>Dest Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDestType()
   * @generated
   * @ordered
   */
  protected DestTypeType destType = DEST_TYPE_EDEFAULT;

  /**
   * This is true if the Dest Type attribute has been set.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   * @ordered
   */
  protected boolean destTypeESet;

  /**
   * The default value of the '{@link #isPersistent() <em>Persistent</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isPersistent()
   * @generated
   * @ordered
   */
  protected static final boolean PERSISTENT_EDEFAULT = true;

  /**
   * The cached value of the '{@link #isPersistent() <em>Persistent</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isPersistent()
   * @generated
   * @ordered
   */
  protected boolean persistent = PERSISTENT_EDEFAULT;

  /**
   * This is true if the Persistent attribute has been set.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   * @ordered
   */
  protected boolean persistentESet;

  /**
   * The default value of the '{@link #getSelector() <em>Selector</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSelector()
   * @generated
   * @ordered
   */
  protected static final String SELECTOR_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getSelector() <em>Selector</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSelector()
   * @generated
   * @ordered
   */
  protected String selector = SELECTOR_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected JmsMessageFilterTypeImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return XmlPackage.Literals.JMS_MESSAGE_FILTER_TYPE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getAcknowledgeMode()
  {
    return acknowledgeMode;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAcknowledgeMode(String newAcknowledgeMode)
  {
    String oldAcknowledgeMode = acknowledgeMode;
    acknowledgeMode = newAcknowledgeMode;
    boolean oldAcknowledgeModeESet = acknowledgeModeESet;
    acknowledgeModeESet = true;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.JMS_MESSAGE_FILTER_TYPE__ACKNOWLEDGE_MODE, oldAcknowledgeMode, acknowledgeMode, !oldAcknowledgeModeESet));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void unsetAcknowledgeMode()
  {
    String oldAcknowledgeMode = acknowledgeMode;
    boolean oldAcknowledgeModeESet = acknowledgeModeESet;
    acknowledgeMode = ACKNOWLEDGE_MODE_EDEFAULT;
    acknowledgeModeESet = false;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.UNSET, XmlPackage.JMS_MESSAGE_FILTER_TYPE__ACKNOWLEDGE_MODE, oldAcknowledgeMode, ACKNOWLEDGE_MODE_EDEFAULT, oldAcknowledgeModeESet));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isSetAcknowledgeMode()
  {
    return acknowledgeModeESet;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getDestName()
  {
    return destName;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDestName(String newDestName)
  {
    String oldDestName = destName;
    destName = newDestName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.JMS_MESSAGE_FILTER_TYPE__DEST_NAME, oldDestName, destName));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public DestTypeType getDestType()
  {
    return destType;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDestType(DestTypeType newDestType)
  {
    DestTypeType oldDestType = destType;
    destType = newDestType == null ? DEST_TYPE_EDEFAULT : newDestType;
    boolean oldDestTypeESet = destTypeESet;
    destTypeESet = true;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.JMS_MESSAGE_FILTER_TYPE__DEST_TYPE, oldDestType, destType, !oldDestTypeESet));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void unsetDestType()
  {
    DestTypeType oldDestType = destType;
    boolean oldDestTypeESet = destTypeESet;
    destType = DEST_TYPE_EDEFAULT;
    destTypeESet = false;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.UNSET, XmlPackage.JMS_MESSAGE_FILTER_TYPE__DEST_TYPE, oldDestType, DEST_TYPE_EDEFAULT, oldDestTypeESet));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isSetDestType()
  {
    return destTypeESet;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isPersistent()
  {
    return persistent;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setPersistent(boolean newPersistent)
  {
    boolean oldPersistent = persistent;
    persistent = newPersistent;
    boolean oldPersistentESet = persistentESet;
    persistentESet = true;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.JMS_MESSAGE_FILTER_TYPE__PERSISTENT, oldPersistent, persistent, !oldPersistentESet));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void unsetPersistent()
  {
    boolean oldPersistent = persistent;
    boolean oldPersistentESet = persistentESet;
    persistent = PERSISTENT_EDEFAULT;
    persistentESet = false;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.UNSET, XmlPackage.JMS_MESSAGE_FILTER_TYPE__PERSISTENT, oldPersistent, PERSISTENT_EDEFAULT, oldPersistentESet));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isSetPersistent()
  {
    return persistentESet;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getSelector()
  {
    return selector;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setSelector(String newSelector)
  {
    String oldSelector = selector;
    selector = newSelector;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.JMS_MESSAGE_FILTER_TYPE__SELECTOR, oldSelector, selector));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__ACKNOWLEDGE_MODE:
        return getAcknowledgeMode();
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__DEST_NAME:
        return getDestName();
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__DEST_TYPE:
        return getDestType();
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__PERSISTENT:
        return isPersistent() ? Boolean.TRUE : Boolean.FALSE;
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__SELECTOR:
        return getSelector();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__ACKNOWLEDGE_MODE:
        setAcknowledgeMode((String)newValue);
        return;
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__DEST_NAME:
        setDestName((String)newValue);
        return;
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__DEST_TYPE:
        setDestType((DestTypeType)newValue);
        return;
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__PERSISTENT:
        setPersistent(((Boolean)newValue).booleanValue());
        return;
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__SELECTOR:
        setSelector((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__ACKNOWLEDGE_MODE:
        unsetAcknowledgeMode();
        return;
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__DEST_NAME:
        setDestName(DEST_NAME_EDEFAULT);
        return;
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__DEST_TYPE:
        unsetDestType();
        return;
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__PERSISTENT:
        unsetPersistent();
        return;
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__SELECTOR:
        setSelector(SELECTOR_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__ACKNOWLEDGE_MODE:
        return isSetAcknowledgeMode();
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__DEST_NAME:
        return DEST_NAME_EDEFAULT == null ? destName != null : !DEST_NAME_EDEFAULT.equals(destName);
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__DEST_TYPE:
        return isSetDestType();
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__PERSISTENT:
        return isSetPersistent();
      case XmlPackage.JMS_MESSAGE_FILTER_TYPE__SELECTOR:
        return SELECTOR_EDEFAULT == null ? selector != null : !SELECTOR_EDEFAULT.equals(selector);
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (acknowledgeMode: ");
    if (acknowledgeModeESet) result.append(acknowledgeMode); else result.append("<unset>");
    result.append(", destName: ");
    result.append(destName);
    result.append(", destType: ");
    if (destTypeESet) result.append(destType); else result.append("<unset>");
    result.append(", persistent: ");
    if (persistentESet) result.append(persistent); else result.append("<unset>");
    result.append(", selector: ");
    result.append(selector);
    result.append(')');
    return result.toString();
  }

} //JmsMessageFilterTypeImpl
